import { VagueOject } from "@/types/common";

interface ConfigType {
    devBaseUrl: string;
    prodBaseUrl: string;
    apiList: VagueOject;
    checkEnvironment(): string;
    rsaPublicKey: string;
}

export const config: ConfigType = {
     devBaseUrl: "http://127.0.0.1:9090",
    //devBaseUrl: "http://192.168.31.100:9090",
    prodBaseUrl: "http://127.0.0.1:3000/api/json/prod",
    apiList: {
        index: "/home/index",//首页
        info: "/home/info",
        addCar: "/car/addCar",
        getCarList: "/car/getCarList",
        checkCar: "/car/checkCar",
        deleteCar: "/car/deleteCar",
        updateCarNum: "/car/updateCarNum",
        submitCar: "/car/submitCar",
        allOrder: "/order/allOrder",
        buyOrder: "/order/buyOrder",
        userlogin:"/user/login",//用户登录
        useradd:"/user/add",//用户注册
        orderallOrder:"/order/allOrder",//我的分类
        userlike:"/user/like",//收藏
        search: "/home/search",//搜索接口，
        activity: "/home/activity",//轮播图下分类
        list: "/type/list",//分类页面
        likeList: "/user/likeList",//我的页面 收藏

    },
    checkEnvironment() {
        let url: string = ""
        switch (import.meta.env.MODE) {
            case "development":
                url = this.devBaseUrl
                break;
            case "production":
                url = this.prodBaseUrl
                break;
        }
        return url;
    },
    rsaPublicKey: `-----BEGIN PUBLIC KEY-----
    MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC9eo8WIbWS5Yql06imlhrW0ZXh
    faivPavdULvYLIxIKyUaOwMPFrPuHqqBNGnYOpiPHAKL+zxk2j4u+6jhB6VK1SOD
    ccSLxIRxd0HmSDS+hBzYRf4vKc8BLlhMrYhnLmcxCc+PJIIa4DfCZnu8FfQlu/5L
    ljjpYN9kHOpHAT+xpQIDAQAB
    -----END PUBLIC KEY-----
    `
}